const server = 'https://t.weijiayingxiao.com'
const fetch = require('./fetch')
module.exports = {
  //保存用户信息到服务器
  saveUserInfo(params) {
    return fetch(`${server}/user`, "PUT", params)
  },
  //获取试卷信息
  getPaperId(taskId,userId){
    return fetch(`${server}/pager_task/` + taskId + `/paper/` + userId,  "POST")
    //return fetch(`${server}/pager_task/` + taskId + `/paper`, "POST")

  },
  //获取试卷题目列表
  getPaperInfo(paperId,searchObj){
    return fetch(`${server}/paper/` + paperId + `/paper_answer`, "GET", searchObj)
  },
  //获取考试配置信息
  getSettingInfo(){
    return fetch(`${server}/paper/` + paperId + `/paper_answer` , "GET")
  },  
  //更新考题答案
  updateAnswer(paperId, params,userId){
    return fetch(`${server}/paper_answer/` + paperId + '/user/' + userId, "PUT", params)
  },
  //提交试卷接口
  submitPaper(paperId, params){
    return fetch(`${server}/paper/` + paperId, "PUT", params)
  },
  //获取城市列表
  getCompanyList(){
    return fetch(`${server}/company?sort=id&id.dir=desc`, "GET")
  },
  //更新用户信息
  updateUserInfo(id,userObj){
    return fetch(`${server}/user/`+id, "PUT", userObj)
  },
  //获取分类列表
  getCategoryList(){
    return fetch(`${server}/category`, "GET")
  },
  //题库
  getQuetionList(type, category, searchObj){
    return fetch(`${server}/type/` + type + `/category/` + category + `/question`, "GET", searchObj)
  },
  //错题列表
  getErrorList(searchObj, userId){
    return fetch(`${server}/wrong/` + userId, "GET", searchObj)
  },
  //模拟卷列表
  getMockPaper(){
    return fetch(`${server}/paper`, "GET")
  },
  //模拟卷详情
  getExamResult(){
    return fetch(`${server}/paper_finish`, "GET")
  },
  //验证用户是否参加多次考试
  getPaperByUser(task, userId, user) {
    return fetch(`${server}/paper/` + task + `/user/` + parseInt(userId), "POST", user)
  },
  //合并提交试卷
  submitPaperByAll(parames) {
    return fetch(`${server}/paper/answer_test`, "POST", parames)
  },
}
